package com.vf.admin.client.service.impl;

import com.vf.admin.client.dao.AppTaskDao;
import com.vf.admin.client.service.AppTaskService;
import com.vf.admin.client.service.AppTxService;
import com.vf.admin.client.tx.vo.RoomGiftVo;
import com.vf.admin.client.tx.vo.UserShiZhi;
import com.vf.admin.client.tx.vo.userSignVo;
import com.vf.admin.common.entity.ResultVo;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.AppTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import static com.vf.admin.client.tx.utils.TxIm.portraitSet;
import static com.vf.admin.client.tx.utils.TxIm.sendGroupMsg;

/**
 * @author anxiang
 * @version 1.0.0
 * @ClassName AppTaskServiceImpl.java
 * @Description TODO
 * @createTime 2021年07月24日 18:04:00
 */

@Service
public class AppTxServiceImpl implements AppTxService {


    @Override
    public boolean sendGroupMessage(Integer code,RoomGiftVo vo,Integer roomTxCode) {
        try {
            ResultVo result = new ResultVo();
            result.setCode(code);
            result.setMessageType(code);
            result.setData(vo);
            net.sf.json.JSONObject obj1 = net.sf.json.JSONObject.fromObject(result);
            String json = obj1.toString().replace("\"", "\"");
            sendGroupMsg(roomTxCode, json);
            return true;
        }catch (Exception e){
            return false;
        }
    }
    @Override
    public boolean updateUserProfile(userSignVo vo, Integer userTxCode) {
        try {
            net.sf.json.JSONObject obj = net.sf.json.JSONObject.fromObject(vo);
            UserShiZhi shiZhi = new UserShiZhi();
            shiZhi.setUserSign(obj.toString());
            shiZhi.setTengxuncode(userTxCode + "");
            return portraitSet(shiZhi);
        }catch (Exception e){
            return false;
        }
    }

}